# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=xmlstarlet
pkgver=1.6.1
pkgrel=2
pkgdesc="A set of tools to transform, query, validate, and edit XML documents"
url="https://xmlstar.sourceforge.net/"
arch="all"
license="MIT"
makedepends="ghostscript libxml2-dev libxslt-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://sourceforge.net/projects/xmlstar/files/xmlstarlet/$pkgver/xmlstarlet-$pkgver.tar.gz/download"

prepare() {
	default_prepare
	update_config_guess
	update_config_sub
}

build() {
	LIBXSLT_PREFIX=/usr \
	LIBXML_PREFIX=/usr \
	./configure \
			--prefix=/usr \
			--enable-build-docs
	make
}

package() {
	make DESTDIR="$pkgdir" install
	ln -s xml $pkgdir/usr/bin/xmlstarlet
	install -Dm0644 Copyright $pkgdir/usr/share/licenses/$pkgname/COPYING
}

sha512sums="4228df812caec7059d7a76986c4d9a4262bd861cc53dca05f341ae6c062be05f1c39fc637918ab00f60f40587c6c556e3c9bfaf8a18b149e3c321a92214dbe8b  xmlstarlet-1.6.1.tar.gz"
